<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
    String contextPath = (String) request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css"
	href="<%=contextPath%>/js/jquery-easyui-1.3/themes/default/easyui.css">
<link rel="stylesheet" type="text/css"
	href="<%=contextPath%>/css/rs.css">
	<link rel="stylesheet" type="text/css" href="<%=contextPath%>/js/jquery-easyui-1.3/themes/icon.css">
<script type="text/javascript"
	src="<%=contextPath%>/js/jquery-easyui-1.3/jquery-1.7.2.min.js"></script>
<script type="text/javascript"
	src="<%=contextPath%>/js/jquery-easyui-1.3/jquery.easyui.min.js"></script>
<script type="text/javascript"
	src="<%=contextPath%>/js/jquery-easyui-1.3/locale/easyui-lang-zh_CN.js"></script>
<script>
$(function() {
	$('#datagrid').datagrid({
		title : '后台日志',
		height : 500,
		pageList: [10,30,50],
		nowrap : true,
		autoRowHeight : false,
		striped : true,
		collapsible : false,
		url : '<%=contextPath%>/log/logAction.do?method=queryAdminLog',
		sortName : 'code',
		sortOrder : 'desc',
		remoteSort : false,
		idField : 'id',
		columns : [ [ 
		{
			field : 'ck',
			checkbox : true
		}, 
		{
			title : 'ID',
			field : 'id',
			width : 80,
			sortable : true
		}, 
		{
			field : 'log_level',
			title : '日志级别',
			width : 80
		}, 
		{
			field : 'operate_type',
			title : '操作类型',
			width : 100,
			sortable : true
		}, 
		{
			field : 'log_time',
			title : '时间',
			width : 100
		}, 
		{
			field : 'remark',
			title : '说明',
			width : 200,
			sortable : true
		} ] ],

		pagination : true,
		rownumbers : true,
		
		toolbar : 
			[{
			id : 'btncut',
			text : '删除	',
			iconCls : 'icon-cut',
			handler : function() {
				deleteRows();
			}
		}]
	});
	
	
	var p = $('#datagrid').datagrid('getPager');
	$(p).pagination({
		onBeforeRefresh : function() {
			
		}
	});
});
function deleteRows()
{
	var rows = $('#datagrid').datagrid('getSelections');
	if (!rows || rows.length == 0) {
		$.messager.alert('提示',
				'请选择要删除的数据!', 'info');
		return;
	}
	
	var param="ids=";
	//循环给提交删除参数赋值
	$.each(rows, function(i, n) {
		if (i == 0) 
		{
			param += n.id;
		} 
		else 
		{
			param += "," + n.id;
		}
	});
	$.messager.confirm(
					'提示',
					'是否删除选中数据?',
					function(r) {
						if (!r) 
						{
							return;
						}
						//提交
						$.post('<%=contextPath%>/log/logAction.do?method=deleteAdminLog',
								param,
								function(msg) 
								{
									//重新加载当前页
									$('#datagrid').datagrid('reload');
								});
					});

}
	
	
</script>
<title></title>
</head>
<body>
	<table id="datagrid" data-option="fit:true">
	</table>
</body>
</html>